package bluerain.io.adapter.ui;

import android.app.Activity;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.ListView;

import bluerain.io.adapter.R;

/**
 * Created by foredawn on 15-9-9.
 * 第一个利用Adapter填充list的例子
 */
public class ArrayAdapterTest extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.array_adapter);
        String[] array1 = new String[]{"呵呵", "嘻嘻", "哈哈"};
        ListView l1 = (ListView) findViewById(R.id.list1);
        ListView l2 = (ListView) findViewById(R.id.list2);

        ArrayAdapter<String> adapter1 =
                new ArrayAdapter<>(this, R.layout.array_item, array1);
        ArrayAdapter<String> adapter2 =
                new ArrayAdapter<>(this, R.layout.checked_item, array1);
        l1.setAdapter(adapter1);
        l2.setAdapter(adapter2);
    }
}
